import java.util.HashMap;

class MethodTable extends HashMap<String, Method>
{
   public void add(Method m) throws BabytalkRuntimeException
   {
      if (containsKey(m.getName()))
         throw new BabytalkRuntimeException("method '" + m.getName() + "' already added");
      
      put(m.getName(), m);
   }

   public Method get(String name) throws BabytalkRuntimeException
   {
      if (!containsKey(name))
         throw new BabytalkRuntimeException("no " + name + " method defined");
      return super.get(name);
   }
}
